import React from "react";
import { IRouteGuards } from "./type";
import { Navigate } from "react-router-dom";
const RouteGuards: React.FC<IRouteGuards> = ({
  isAuthentication,
  children,
}) => {
  const protectedRoutes = () => {
    return isAuthentication ? children : <Navigate to={"/"}></Navigate>;
  };
  return <>{protectedRoutes()}</>;
};
export default RouteGuards;
